package com.cnswhy.cloud.server.merchant.controller.center;

import com.cnswhy.cloud.server.core.entity.SmsTempate;
import com.cnswhy.cloud.server.core.dto.SmsTempateSaveDTO;
import com.cnswhy.cloud.server.core.dto.SmsTempateUpdateDTO;
import com.cnswhy.cloud.server.core.dto.SmsTempatePageDTO;
import com.cnswhy.cloud.server.core.service.SmsTempateService;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.cnswhy.cloud.common.core.base.controller.SuperController;
import com.cnswhy.cloud.common.core.base.R;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
//import com.github.zuihou.security.annotation.PreAuth;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 * 前端控制器
 * 
 * </p>
 *
 * @author cnswhy
 * @date 2020-10-27
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/smsTempate")
@Api(value = "SmsTempate", tags = "")
//@PreAuth(replace = "smsTempate:")
public class SmsTempateController extends SuperController<SmsTempateService, Long, SmsTempate, SmsTempatePageDTO, SmsTempateSaveDTO, SmsTempateUpdateDTO> {

    /**
     * Excel导入后的操作
     *
     * @param list
     */
    @Override
    public R<Boolean> handlerImport(List<Map<String, String>> list){
        List<SmsTempate> smsTempateList = list.stream().map((map) -> {
            SmsTempate smsTempate = SmsTempate.builder().build();
            return smsTempate;
        }).collect(Collectors.toList());

        return R.success(baseService.saveBatch(smsTempateList));
    }
}
